﻿$(function () {
	var hidden;
	var undoPanel = $('.undoDelete');
	undoPanel.hide();

	$('.deleteButton').click(function () {
		var billId = $(this).attr('billId');
		$('#undo').attr('billId', billId);
		undoPanel.show();
		$(this).parent().parent().fadeTo(400, 0, function () {
			hidden = $(this)
			hidden.hide();
		});
		$.post('Bill/Delete', { id: billId });
		return false;
	});

	$('#undo').click(function () {
		var billId = $('#undo').attr('billId');
		$('#undo').attr('billId', '');
		undoPanel.hide();
		hidden.fadeTo(400, 100, function () {
			hidden.show();
		});
		$.post('Bill/UnDelete', { id: billId });
		return false;
	});
});